package com.jsbs.iam.auth.mapper;

import com.jsbs.iam.auth.dto.IamOrgInfoAlreadySelectDto;
import com.jsbs.iam.auth.dto.IamRoleBindUserByOrgDto;
import com.jsbs.iam.auth.dto.IamRoleOrgDeleteDto;
import com.jsbs.iam.auth.entity.IamRoleOrgFrameworkRelation;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface IamRoleOrgFrameworkRelationMapper {

    /**
     * 功能描述：根据组织+岗位信息查询角色
     * @param companyCode
     * @param orgInfoList
     * @param postIdList
     * @return
     */
    List<IamRoleOrgFrameworkRelation> queryRoleByOrg(@Param("companyCode") String companyCode, @Param("orgInfoList") List<String> orgInfoList, @Param("postIdList") List<String> postIdList);

    /**
     * 功能描述：删除某个角色下已经绑定的组织
     * @param iamRoleOrgDeleteDto
     * @return int
     */
    int deleteRoleBindOrg(@Param("iamRoleOrgDeleteDto") IamRoleOrgDeleteDto iamRoleOrgDeleteDto);

    /**
     * 功能描述：新增组织编码或岗位编码，至角色组织架构中间关系表
     * @param iamRoleBindUserByOrgDto
     * @return int
     */
    int insertRoleBindOrg(@Param("iamRoleBindUserByOrgDto") IamRoleBindUserByOrgDto iamRoleBindUserByOrgDto);

    /**
     * 功能描述：获取某个角色下某个组织树下已经勾选的组织或岗位，回填
     * @param iamOrgInfoAlreadySelectDto
     * @return List
     */
    @MapKey("id")
    List<Map<String, String>> getAlreadyOrgThreeInfo(@Param("iamOrgInfoAlreadySelectDto")IamOrgInfoAlreadySelectDto iamOrgInfoAlreadySelectDto);



}